home *** CD-ROM | disk | FTP | other *** search
- ;*****************************************************************************
- ; Assembly language functions for CHKHDW.ASM
- ; 10/29/89
- ; 02/18/91 JEM Updated for use w/ MASM 5.1
- ;*****************************************************************************
- .MODEL COMPACT,C
- .CODE
-
- ;
- ; Name: cpu_type
- ; Function: Returns a number indicating CPU TYPE
- ; 86,286 or 386, decimal.
- ; Caller: MSC 4.0, Compact
- ; Args: None
- ;
- ; Author: JM
- ; Date: 10/30/89
- cpu_type PROC NEAR USES ES DI DS SI
- pushf ; save flag register contents
- xor ax,ax ;
- push ax ; save a zero word on the stack
- popf ; try to set the flag reg to all zeros
- pushf
- pop ax ; get the new flag contents
-
- and ax,0F000H
- cmp ax,0F000H ; did we set bit 15?
- jz is_808x ; if not, it's an 8086/8088
-
- mov ax,07000H ; see if we can set bits 12-14
- push ax
- popf ; try to set the flags again
- pushf
- pop ax ; check the results
- and ax,07000H
- jz is_286 ; if we can't set the bits, its an 80286
-
- mov ax,386 ; otherwise, its an 80386
- jmp cpu_done
-
- is_808x:
- mov ax,88 ; it's an 8088
- jmp cpu_done
-
- is_286:
- mov ax,286 ; it's an 80286
-
- cpu_done:
- popf ; restore original flags
- ret
- cpu_type ENDP
-
- ; Returns TRUE if an FPU is present, FALSE otherwise
- fpu_present PROC NEAR USES ES DS SI DI
- int 11h ; get equipment list
- and ax,2 ; see if FPU bit is set
- cmp ax,0
- je fpu_done ; if no fpu, then we're done
- mov ax,1 ; set value to TRUE
-
- fpu_done:
- ret
- fpu_present ENDP
-
- END
-